package edu.cs.usask.ca.silver.plugin.rcp.app;

import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

/**
 * This class defines the context menu and the actions that are associated with
 * the items contained in the menu. It also register actions, and determines the
 * layout of the items
 * 
 * @author Yudi Xue
 */
public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

	private IWorkbenchAction introAction;
	private IWorkbenchAction exitAction;
	private IWorkbenchAction resetPerspectiveAction;

	public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
		super(configurer);
	}

	protected void makeActions(IWorkbenchWindow window) {
		introAction = ActionFactory.INTRO.create(window);
		exitAction = ActionFactory.QUIT.create(window);
		resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE.create(window);

		register(introAction);
		register(exitAction);
		register(resetPerspectiveAction);
	}
	//
	// protected void fillMenuBar(IMenuManager menuBar) {
	//
	// MenuManager fileMenu = new MenuManager("&File",
	// IWorkbenchActionConstants.M_FILE);
	// menuBar.add(fileMenu);
	// /*
	// * Within File menu, two menu contributions were added through
	// * extensions.
	// */
	//
	// MenuManager windowMenu = new MenuManager("&Window",
	// IWorkbenchActionConstants.M_WINDOW);
	// menuBar.add(windowMenu);
	// windowMenu.add(resetPerspectiveAction);
	//
	// MenuManager helpMenu = new MenuManager("&Help",
	// IWorkbenchActionConstants.M_HELP);
	// menuBar.add(helpMenu);
	//
	// // Help
	// helpMenu.add(introAction);
	//
	// }
	//
	// protected void fillCoolBar(ICoolBarManager coolBar) {
	// IToolBarManager toolbar = new ToolBarManager(SWT.FLAT | SWT.RIGHT);
	// coolBar.add(new ToolBarContributionItem(toolbar, "main"));
	// toolbar.add(exitAction);
	// }

}
